<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class ActivityPage extends Model
{
    use HasFactory;

    protected $table = 'sp_activity_page';
    protected $primaryKey = 'id';
    public $timestamps = false;

    const ACTIVITY_PAGE_KEY = 'activity_page_list';

    //status状态  1未发布   2已发布
    const ACTIVITY_PAGE_STATUS_UNPUBLISHED = 1;//未发布
    const ACTIVITY_PAGE_STATUS_PUBLISHED = 2;//已发布

    protected function GetActivityPage()
    {
        $data = $this->get();
        $data = $data ? $data->toArray() : [];
        return $data;
    }

    protected function GetOneActivityPage($where)
    {
        $data = $this
            ->where($where)
            ->first();
        $data = $data ? $data->toArray() : [];
        return $data;
    }

    //根据id修改
    protected function editDataById($id, $data)
    {
        $where = array(
            'id' => $id,
        );
        return $data = $this->where($where)->update($data);
    }


}
